#!/usr/bin/env python

# Evaluate the sum of all the amicable numbers under 10000.
# url : http://projecteuler.net/index.php?section=problems&id=21

# 2010-03-30

def d(n):
    return sum([ a for a in range(1, n) if n % a == 0 ])

if __name__ == "__main__":
    print sum([ a for a in range(1, 10000) if a != d(a) and a == d(d(a))])
